Math (math)

Power and logarithmic functions

exp

Return e**x.

 

{ }
[{"paths":[],"data":{"math":"math","call":"math.exp","math.exp":"exp","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"x":2},"height":32,"width":120,"step":"get exp (e**2)","data_to_var":"exp","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"exp":7.38905609893065}

log

With one argument, return the natural logarithm of x (to base e).

With two arguments, return the logarithm of x to the given base, calculated as log(x)/log(base).

 

{ }
[{"paths":[],"data":{"math":"math","call":"math.log","math.log":"log","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"x":8,"base":2},"height":32,"width":120,"step":"get log of 8, base 2","data_to_var":"log","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"log":3}

log1p

Return the natural logarithm of 1+x (base e). The result is calculated in a way which is accurate for x near zero.

 

{ }
[{"paths":[],"data":{"math":"math","call":"math.log1p","math.log1p":"log1p","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"x":1.0e-25},"height":32,"width":120,"step":"get log1p","data_to_var":"log1p","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"log1p":1.0e-25}

log10

Return the base-10 logarithm of x. This is usually more accurate than log(x, 10).

 

{ }
[{"paths":[],"data":{"math":"math","call":"math.log10","math.log10":"log10","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"x":5},"height":32,"width":120,"step":"get log10 of 5","data_to_var":"log10","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"log10":0.6989700043360189}

pow

Return x raised to the power y. Exceptional cases follow Annex ‘F’ of the C99 standard as far as possible. In particular, pow(1.0, x) and pow(x, 0.0) always return 1.0, even when x is a zero or a NaN. If both x and y are finite, x is negative, and y is not an integer then pow(x, y) is undefined, and raises an error.

Unlike the built-in ** operator, math.pow() converts both its arguments to type float. Use ** or the built-in pow() function for computing exact integer powers.

 

{ }
[{"paths":[],"data":{"math":"math","call":"math.pow","math.pow":"pow","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"x":10,"y":2},"height":32,"width":120,"step":"get 10 to the power of 2","data_to_var":"pow","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"pow":100}

sqrt

Return the square root of x.

 

{ }
[{"paths":[],"data":{"math":"math","call":"math.sqrt","math.sqrt":"sqrt","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"x":9},"height":32,"width":120,"step":"get sqrt of 9","data_to_var":"sqrt","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"sqrt":3}